-
Notifications
You must be signed in to change notification settings - Fork 132
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update package.json: changed pattern "./" to "./*" #135
Conversation
On Angular when executes command 'ng build --prod': - Generating browser application bundles...(node:16716) [DEP0148] DeprecationWarning: Use of deprecated folder mapping "./" in the "exports" field module resolution of the package at {{APP_PATH}}\node_modules\tslib\package.json. Update this package.json to use a subpath pattern like "./*". (Use `node --trace-deprecation ...` to show where the warning was created)
I sent this change to fix the deprecation on new apps, this is a minor change. I don't undestand why test CI for 14.x failed. |
This can be rebased for the CI fix 👍🏻 |
On Angular 11 + Node v15
|
Any update on this ? @Neizan-93 Can you rebase on master and after can we merge this. I'm having this warning with node 15. |
I just closed #139 as a duplicate of this. In #139, the author points to postcss/postcss#1455, which tried to solve the deprecation in the same way. From the linked PR it sounds like this breaks NodeJS 12.x and there are still issues with it:
@weswigham any thoughts? |
@orta We are skipping esm node modules for NodeJS 12, so we're not seeing a possible error due to the fact NodeJS 12 supports subpath exports but not subpath patterns. |
I've done some research and Update: NodeJS 12.20.1 seems to work fine with The test case I used was: // index.mjs
async function main() {
// (a)
try {
const tslib1 = await import("tslib");
console.log("default" in tslib1 ? "CommonJS" : "ESM");
}
catch (e) {
console.error(e.name, e.message);
}
// (b)
try {
const tslib2 = await import("tslib/tslib.js");
console.log("default" in tslib2 ? "CommonJS" : "ESM");
}
catch (e) {
console.error(e.name, e.message);
}
// (c)
try {
const tslib3 = await import("tslib/tslib.es6.js");
console.log("default" in tslib3 ? "CommonJS" : "ESM");
}
catch (e) {
console.error(e.name, e.message);
}
// (d)
try {
const tslibpkg = await import("tslib/package.json");
if (tslibpkg.default.name !== "tslib") throw new Error ("Unexpected result");
console.log("ok");
}
catch (e) {
console.error(e.name, e.message);
}
}
main(); Results:
NOTES:
The most common use case for
However, subpath exports are trickier:
The only consistency between 12.18 and 15.4 is Since NodeJS 12 is a Maintenance LTS, is our stance to only support the latest version of a Maintenance LTS? If so, then this change is probably fine. |
Interesting, I didn't know it was supported in 12 TBH. I think it's pretty reasonable to assume here that the 12.18.x versions had a bug and we can add release notes stating they can update to a later version of 12.x to fix issues? |
It was experimental in 12. I think this change is fine. |
This really needs to be merged if possible @JonSenpai @rbuckton, there are quite a few dependencies that rely on tslib, and currently I'm facing a series of deprecation warnings during every build. I can just suppress it but it's not ideal :( |
This PR should solve #152. Is there anything still blocking this from being merged? Sidenote: Why is the |
@csvn interesting approach using both syntaxes or exporting only the package.json. Running the test script from @rbuckton on the current node version (17):
Seems like Made a proposal with explicitly defining the files here: #163 Note: Came across this thread after I created the PR and wasn't aware of the test script. Will run the same tests against that solution also, and post the results in the PR. |
Co-authored-by: ExE Boss <[email protected]>
@rbuckton do we know when the next release will be? It seems the last one was in August. |
Current code is: VS Code seems to still complain, saying "Property ./ is not allowed." Maybe should just be Line 36 in c827964
|
Leaving ./ in there will still cause a warning I reckon as seen in microsoft#135
|
Ah yes, now I get it. It's for backwards compatability. I'll ignore the VS Code warning. Thanks. Please ignore me :) |
On Angular when executes command 'ng build --prod':
Update this package.json to use a subpath pattern like "./*".
(Use
node --trace-deprecation ...
to show where the warning was created)